Fedora 21
Sponsored Link

Docker : Install
2015/01/03
 
Install Docker which is the Linux Container Tool.
[1] Install Docker.
[root@dlp ~]#
yum -y install docker-io
[root@dlp ~]#
systemctl start docker

[root@dlp ~]#
systemctl enable docker

[2] Download the official image and create a Container and output the words "Welcome to the Docker World" from the Container.
[root@dlp ~]#
docker run fedora /bin/echo "Welcome to the Docker World"

Unable to find image 'fedora' locally
Pulling repository fedora
00a0c78eeb6d: Download complete
Welcome to the Docker World
# executed
[3] Connect to the interactive session of a Container with "i" and "t" option like follows. If exit from the Container session, the process of a Container finishs.
[root@dlp ~]#
docker run -i -t fedora /bin/bash

bash-4.3#
# Container's console
bash-4.3#
uname -a

Linux fa91147288b4 3.17.6-300.fc21.x86_64 #1 SMP Mon Dec 8 22:29:32 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
bash-4.3#
exit

exit
[root@dlp ~]#
# just backed
[4] If exit from the Container session with keeping container's process, push Ctrl+p, and Ctrl+q key.
[root@dlp ~]#
docker run -i -t fedora /bin/bash

bash-4.3# [root@dlp ~]#
# Ctrl+p, Ctrl+q
[root@dlp ~]#
docker ps
# display docker process

CONTAINER ID   IMAGE      COMMAND      CREATED          STATUS          PORTS  NAMES
e9ecb988dabf   fedora:21  "/bin/bash"  18 seconds ago   Up 17 seconds          trusting_goodal

# connect to container's session

[root@dlp ~]#
docker attach e9ecb988dabf

bash-4.3#
# connected
# shutdown container's process from Host's console

[root@dlp ~]#
docker kill e9ecb988dabf

[root@dlp ~]#
docker ps

CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES
 
Tweet